<?php
namespace app\admin\controller;
use think\Controller;
use think\Db;
class User extends Controller
{
    // 用户管理页（列表）
    public function index()
    {
         $res = Db::table('user')
                 ->select();
        //  dump($res);
        //  exit;
         $this->assign('res',$res);
        return $this->fetch();
    }
    public function dong($user_id)
    {
       $res =  Db::table('user')->where('user_id',$user_id)->update(['status' =>1]);
       if($res)
        {
            return $this->success('冻结成功','user/index');
        }
        else
        {
            return $this->error('失败');
        }
    }
    public function qu($user_id)
    {
       $res =  Db::table('user')->where('user_id',$user_id)->update(['status' =>0]);
       if($res)
        {
            return $this->success('解冻成功','user/index');
        }
        else
        {
            return $this->error('失败');
        }
    }
}
